<?php

class Generator_Form_Controller extends Zend_Form
{

	public function __construct(Zend_Controller_Action $controller)
	{
		$table_name = $this->createElement ( 'text', 'table_name' )->setLabel ( "Tên bảng" )->setRequired ( true );
		$module_name = $this->createElement ( 'text', 'module_name' )->setLabel ( "Tên module" )->setRequired ( true );
		$controller_name = $this->createElement ( 'text', 'controller_name' )->setLabel ( "Tên controller" )->setRequired ( true )->setValue('index');
		$view_index_use_order = $this->createElement ( 'radio', 'view_index_use_order' )->setLabel ( "Tính năng sắp xếp thứ tự" )->setRequired ( true )->setMultiOptions(array(0=>'Không',1=>'Có'))->setValue(1);
		$view_index_use_status = $this->createElement ( 'radio', 'view_index_use_status' )->setLabel ( "Tính năng kích hoạt / vô hiệu hóa" )->setRequired ( true )->setMultiOptions(array(0=>'Không',1=>'Có'))->setValue(1);
		$generator_file = $this->createElement ( 'multiCheckbox', 'generator_file' )->setLabel ( "Danh sách file cần tạo" )->setRequired ( true )->setMultiOptions(Zend_Registry::get('generator')->generator_file->toArray());
		$html = $this->createElement ( 'textarea', 'html' )->setLabel ( "Nội dung chương trình tạo ra" )->setAttrib("readonly","readonly");
		
		$this->addElements ( array (
			$table_name,
			$module_name,			
			$controller_name,
			$generator_file,
			$view_index_use_order,
			$view_index_use_status,			
			$html,
		) );
		
		$controller->getHelper ( 'common' )->form ( $this );
		$html->removeFilter('StripTags');
	}
}
